<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>UI Brick - 加速网站前端开发</title>
    <link rel="stylesheet" href="//at.alicdn.com/t/font_359250_q9g4vrv0i1.css">
    <link rel="stylesheet/less" type="text/css" href="./base/style.less" />
    <link rel="stylesheet/less" type="text/css" href="./bricks/page/panel/panel.less" />
    <link rel="stylesheet/less" type="text/css" href="./bricks/component/page-preview/page-preview.less">
    <script src="js/jquery-3.4.1.min.js"></script>
    <script src="js/less.min.js"></script>
    <script src="bricks/component/page-preview/page-preview.js"></script>
</head>
<body>
<div class="ub-panel">
    <div class="left">
        <div class="logo">
            UI Brick
        </div>
        <div class="menu">
            <div class="title">通用组件</div>
            <div class="items">
                <a href="page.html?url=component/base/base" target="main">Base</a>
                <a href="page.html?url=component/header/header" target="main">Header</a>
                <a href="page.html?url=component/footer/footer" target="main">Footer</a>
                <a href="page.html?url=component/nav/nav" target="main">Nav</a>
                <a href="page.html?url=component/menu/menu" target="main">Menu</a>
                <a href="page.html?url=component/list/list" target="main">List</a>
                <a href="page.html?url=component/search/search" target="main">Search</a>
                <a href="page.html?url=component/article/article" target="main">Article</a>
                <a href="page.html?url=component/page/page" target="main">Paginate</a>
                <a href="page.html?url=component/banner/banner" target="main">Banner</a>
                <a href="page.html?url=component/panel/panel" target="main">Panel</a>
                <a href="page.html?url=component/video/video" target="main">Video</a>
                <a href="page.html?url=component/form/form" target="main">Form</a>
                <a href="page.html?url=component/lister/lister" target="main">Lister</a>
                <a href="page.html?url=component/tag/tag" target="main">Tag</a>
            </div>
            <div class="title">业务组件</div>
            <div class="items">
                <a href="page.html?url=page/account/login" target="main">Login/Register</a>
                <a href="page.html?url=page/member/member" target="main">UserCenter</a>
                <a href="page.html?url=page/panel/frame" target="main">Frame</a>
            </div>
        </div>
    </div>
    <div class="right">
        <div class="top">
            <div class="menu" id="ubPreviewSwitch">
                <a data-page-preview-type="pc" class="active" href="javascript:;">
                    <i class="iconfont icon-pc"></i>
                    PC版
                </a>
                <a data-page-preview-type="mobile" href="javascript:;">
                    <i class="iconfont icon-phone"></i>
                    手机版
                </a>
                <a data-page-preview-type="window" href="javascript:;">
                    <i class="iconfont icon-link2"></i>
                    新窗口打开
                </a>
            </div>
        </div>
        <div class="content fixed">

            <div class="ub-page-preview" data-ub-page-preview>
                <div class="iframe">
                    <iframe id="main" name="main" src="page.html?url=component/base/base" frameborder="0"></iframe>
                </div>
            </div>

        </div>
    </div>
</div>
<script src="bricks/component/page-preview/page-preview-starter.js"></script>
<script>
    $(function () {
        var $types = $('[data-page-preview-type]');
        var $iframe = $('[data-ub-page-preview] .iframe');
        $types.on('click', function () {
            var type = $(this).attr('data-page-preview-type');
            if ('window' == type) {
                var url = $('#main').get(0).contentWindow.location.href;
                var a = document.createElement("a");
                a.setAttribute("href", url);
                a.setAttribute("target", "_blank");
                document.body.appendChild(a);
                a.click();
                a.parentNode.removeChild(a);
                return false;
            }
            $types.removeClass('active');
            $(this).addClass('active');
            $iframe.removeClass('pc').removeClass('mobile').addClass(type);
            return false;
        });
    });
</script>
</body>
</html>
